package com.mda.log;

import org.apache.log4j.Level;

/**
 * Created by Administrator on 13-12-8.
 */
public class Log4jLogger extends Logger {
    private org.apache.log4j.Logger log;

    private String callerFQCN = Log4jLogger.class.getName();

    public Log4jLogger(Class<?> clazz) {
        this.log = org.apache.log4j.Logger.getLogger(clazz);
    }

    public Log4jLogger(String name) {
        this.log = org.apache.log4j.Logger.getLogger(name);
    }

    @Override
    public void debug(String msg) {
        log.log(callerFQCN, Level.DEBUG, msg, null);
    }

    @Override
    public void debug(String msg, Throwable t) {
        log.log(callerFQCN, Level.DEBUG, msg, t);
    }

    @Override
    public void info(String msg) {
        log.log(callerFQCN, Level.INFO, msg, null);
    }

    @Override
    public void info(String msg, Throwable t) {
        log.log(callerFQCN, Level.INFO, msg, t);
    }

    @Override
    public void warn(String msg) {
        log.log(callerFQCN, Level.WARN, msg, null);
    }

    @Override
    public void warn(String msg, Throwable t) {
        log.log(callerFQCN, Level.WARN, msg, t);
    }

    @Override
    public void error(String msg) {
        log.log(callerFQCN, Level.ERROR, msg, null);
    }

    @Override
    public void error(String msg, Throwable t) {
        log.log(callerFQCN, Level.ERROR, msg, t);
    }

    @Override
    public boolean isDebugEnabled() {
        return log.isDebugEnabled();
    }
}
